-
Notifications
You must be signed in to change notification settings - Fork 3
Add block inserter flag and initial infrastructure #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
key = "GUTENBERG_EDITOR_URL" | ||
value = "http://localhost:5173/" | ||
isEnabled = "NO"> | ||
isEnabled = "YES"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since #191 (comment), should we enable GUTENBERG_EDITOR_URL
by default? I keep doing this every time I work on the editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. However, let's also enable the GUTENBERG_EDITOR_REMOTE_URL
environment variable as well.
We should also update the README documentation to match the new default settings. The README recently changed. I suggest rebasing this atop the latest trunk
branch and applying the following diff
diff --git a/README.md b/README.md
index 977bcba..9993c75 100644
--- a/README.md
+++ b/README.md
@@ -26,17 +26,19 @@ Once finished, the web app can now be accessed in your browser by visiting the U
### Demo App
-This demo app is useful for quickly testing changes made to the editor. By default, the demo app uses a production build of the web app bundled with the GutenbergKit package—i.e., the output of the project's `make build` command. During development, however, it is more useful to run the web app with a server and provide the server URL as an environment variable for the demo app, so that changes are displayed in the app immediately.
+This demo app is useful for quickly testing changes made to the editor.
#### iOS
+The iOS demo app loads the development server by default.
+
1. Start the development server by running `make dev-server`.
1. Launch Xcode and open the `ios/Demo-iOS/Gutenberg.xcodeproj` project.
1. Select the `Gutenberg` target.
-1. Navigate to _Product_ → _Scheme_ → _Edit Scheme_.
-1. Add an environment variable named `GUTENBERG_EDITOR_URL` with the development server URL.
1. Run the app.
+Alternatively, you can load a production build of the web app bundled with the GutenbergKit package by running `make build` and disabling the `GUTENBERG_EDITOR_URL` environment variable by navigating to _Product_ → _Scheme_ → _Edit Scheme_ in Xcode.
+
<details>
<summary>Example Xcode environment variable</summary>
@@ -46,6 +48,8 @@ This demo app is useful for quickly testing changes made to the editor. By defau
#### Android
+The Android demo app loads the production build of the web app bundled with the GutenbergKit package by default—i.e., the output of the project's `make build` command). It can be configured to load the development server by setting a `GUTENBERG_EDITOR_URL` environment variable in the `android/local.properties` file.
+
1. Start the development server by running `make dev-server`.
1. Launch Android Studio and open the `android` project.
1. Modify the `android/local.properties` file to include an environment variable named `GUTENBERG_EDITOR_URL` with the development server URL.
#warning("1. Update the siteURL and authHeader values below") | ||
#warning("2. Install the Jetpack plugin to the site") | ||
// Steps: | ||
// 1. Update the siteURL and authHeader values below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't be warnings.
private let configuration: EditorConfiguration | ||
|
||
@State private var viewModel = EditorViewModel() | ||
@State private var editorViewController: EditorViewController? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up to the previous PR
} | ||
|
||
// Style the add block button with rounded black background | ||
.gutenberg-kit-editor-toolbar .gutenberg-kit-add-block-button { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now. Eventually, we need to consideration Android design patterns.
export function showBlockInserter() { | ||
const blocks = getBlockTypes().map( ( blockType ) => { | ||
return { | ||
name: blockType.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only passing the information we need to show the editor (except for the icons – we'll need to figure out how to manage those).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a solid start. I left a few suggestions, but approving because this worked as expected for me.
key = "GUTENBERG_EDITOR_URL" | ||
value = "http://localhost:5173/" | ||
isEnabled = "NO"> | ||
isEnabled = "YES"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. However, let's also enable the GUTENBERG_EDITOR_REMOTE_URL
environment variable as well.
We should also update the README documentation to match the new default settings. The README recently changed. I suggest rebasing this atop the latest trunk
branch and applying the following diff
diff --git a/README.md b/README.md
index 977bcba..9993c75 100644
--- a/README.md
+++ b/README.md
@@ -26,17 +26,19 @@ Once finished, the web app can now be accessed in your browser by visiting the U
### Demo App
-This demo app is useful for quickly testing changes made to the editor. By default, the demo app uses a production build of the web app bundled with the GutenbergKit package—i.e., the output of the project's `make build` command. During development, however, it is more useful to run the web app with a server and provide the server URL as an environment variable for the demo app, so that changes are displayed in the app immediately.
+This demo app is useful for quickly testing changes made to the editor.
#### iOS
+The iOS demo app loads the development server by default.
+
1. Start the development server by running `make dev-server`.
1. Launch Xcode and open the `ios/Demo-iOS/Gutenberg.xcodeproj` project.
1. Select the `Gutenberg` target.
-1. Navigate to _Product_ → _Scheme_ → _Edit Scheme_.
-1. Add an environment variable named `GUTENBERG_EDITOR_URL` with the development server URL.
1. Run the app.
+Alternatively, you can load a production build of the web app bundled with the GutenbergKit package by running `make build` and disabling the `GUTENBERG_EDITOR_URL` environment variable by navigating to _Product_ → _Scheme_ → _Edit Scheme_ in Xcode.
+
<details>
<summary>Example Xcode environment variable</summary>
@@ -46,6 +48,8 @@ This demo app is useful for quickly testing changes made to the editor. By defau
#### Android
+The Android demo app loads the production build of the web app bundled with the GutenbergKit package by default—i.e., the output of the project's `make build` command). It can be configured to load the development server by setting a `GUTENBERG_EDITOR_URL` environment variable in the `android/local.properties` file.
+
1. Start the development server by running `make dev-server`.
1. Launch Android Studio and open the `android` project.
1. Modify the `android/local.properties` file to include an environment variable named `GUTENBERG_EDITOR_URL` with the development server URL.
EditorView(configuration: .default) | ||
} label: { | ||
Text("Bundled Editor") | ||
Button("Show Editor") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest retaining "bundled" somewhere to differentiate from the remote editors and remain aligned with Android's demo app/project documentation.
if ( isInserterOpened ) { | ||
setIsInserterOpened( false ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this achieving a specific outcome?
display: block; | ||
} | ||
|
||
// width: 50px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commented code should likely be removed.
} | ||
|
||
// Style the add block button with rounded black background | ||
.gutenberg-kit-editor-toolbar .gutenberg-kit-add-block-button { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now. Eventually, we need to consideration Android design patterns.
svg { | ||
background: #eae9ec; | ||
border-radius: 18px; | ||
color: wordpress.$black; | ||
padding: 1px; | ||
width: 32px; | ||
height: 32px; | ||
display: block; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we place this after the attributes declared for .gutenberg-kit-editor-toolbar .gutenberg-kit-add-block-button
. I.e., move this after the current line 88.
What?
isNativeInserterEnabled
flag toEditorConfiguration
Part of #162.
Testing Instructions
Screenshots or screencast
Screen.Recording.2025-10-09.at.10.56.08.AM.mov